﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;
using WoChu.RfClient.Entity;
using System.Data;

namespace WoChu.RfClient.Duty
{
    public class OffShelvesOrderUIRule:IOffShelvesOrder
    {
        private static OffShelvesOrderUIRule _NewInstance = new OffShelvesOrderUIRule();

        public static OffShelvesOrderUIRule NewInstance
        {
            get
            {
                if (_NewInstance == null)
                {
                    _NewInstance = new OffShelvesOrderUIRule();
                }

                return _NewInstance;
            } 
        }


        #region IOffShelvesOrder 成员 

        public List<OffShelvesInfo> GetOffCellNo(string userID)
        {
            try
            {
                List<OffShelvesInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrder>.NewInstance.InvokeWebMethod<List<OffShelvesInfo>>("GetOffCellNo", new object[] { userID });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public List<OffShelvesInfo> GetOffShelvesInfo(string cellNo, string batchNo, string userID, DateTime offShelvesDate)
        {
            try
            {
                List<OffShelvesInfo> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrder>.NewInstance.InvokeWebMethod<List<OffShelvesInfo>>("GetOffShelvesInfo", new object[] { cellNo, batchNo, userID, offShelvesDate });

                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        public OutPutParams<bool> SetOffShelvesState(string setType, List<OffShelvesInfo> lstOffShelves)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrder>.NewInstance.InvokeWebMethod<List<OffShelvesInfo>, OutPutParams<bool>>("SetOffShelvesState", new object[] { setType }, lstOffShelves);
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }
 
        public OutPutParams<bool> SetOffShelves(string userID, List<OffShelvesInfo> lstOffShelves)
        {
            try
            {
                OutPutParams<bool> _result = WoChu.CF.BaseFrame.WebClient.WebGetHelper<IOffShelvesOrder>.NewInstance.InvokeWebMethod<List<OffShelvesInfo>, OutPutParams<bool>>("SetOffShelves", new object[] { userID }, lstOffShelves);
                return _result;
            }
            catch (Exception ex)
            {
                WoChu.CF.BaseFrame.Util.MessageBoxEx.Show(ex);
            }
            return null;
        }

        #endregion
 
    }
}
